function SCANER (caracter,nBATA,puerto,velocidad)

LOCAL tecla
LOCAL car:= SPACE(1)

caracter := 0

do while asc(car) != 13
   //IF estado //set_ser
      lee_ser(puerto, @car) //lee_ser(@car)
      //@00,30 say car
      if ( (asc(car) != 0) .and. (asc(car) != 10);
	   .and. (asc(car) != 13))
	 nBATA += car
	 /*
	 @01,00 say "car"
	 @01,10 say car
	 */
      endif
   //ENDIF

   tecla = inkey()
   if tecla != 0
      caracter := tecla
      //keyboard chr(tecla)
      car := chr(13)
   endif

enddo

RETURN .T.




